<!--  @author:ymy  -->
<template>
  <div class="footer">
    <van-tabbar v-model="active">
      <van-tabbar-item @click="changeRouter('home')" icon="home-o">首页</van-tabbar-item>
      <van-tabbar-item @click="changeRouter('course')" icon="tv-o">教程</van-tabbar-item>
      <van-tabbar-item @click="changeRouter('school')" icon="label-o">网校</van-tabbar-item>
      <van-tabbar-item @click="changeRouter('bosses')" icon="manager-o">大咖</van-tabbar-item>
      <van-tabbar-item @click="changeRouter('community')" icon="chat-o">社区</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
export default {
  name: 'Footer',
  data() {
    return {
      active: 0,
    };
  },
  created() {
    this.active = this.$route.meta.index;
  },
  methods: {
    changeRouter(targetRoute) {
      this.$router.push({ name: targetRoute }).catch(() => {});
    },
  },
};
</script>
<style lang="less" scoped>
.footer {
  z-index: 100;
  width: 100vw;
  height: 0.49rem;
  font-size: 0.12rem;
  display: flex;
  justify-content: space-around;
  align-items: center;
  position: fixed;
  bottom: 0px;
  left: 0px;
  text-align: center;
}
</style>
